﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace MasterPageGroupF3
{
    public partial class ChiTietSanPhamHCM : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Session["idCity"] = 2;
            if (Request.QueryString["logout"] != null)
            {
                if (Request.QueryString["logout"].ToString().Equals("true"))
                {
                    Session.Remove("UserName");
                    Session.Remove("Provider");
                }
            }

            if (Session["UserName"] != null)
            {

                Label lbTaiKhoan = (Label)this.Master.FindControl("lbTaiKhoan");
                String User = Session["UserName"].ToString();
                lbTaiKhoan.Text = "<a href=\"capNhatThongTinCaNhan.aspx?IDMember=" + User + "\">" + User + "</a>";

                Label lbLogout = (Label)this.Master.FindControl("lbLogout");
                lbLogout.Text = "<li><img src=\"../skin/frontend/default/inspire-blue/images/citydivider.jpg\"/></li>" +
                    "<li class=\"first\"><a href=\"ChiTietSanPham.aspx?logout=true\">Thoát</a></li>";
                Label lbDangKy = (Label)this.Master.FindControl("lbDangKy");
                lbDangKy.Text = "";
            }
            if (Session["Provider"] != null)
            {
                Label lbTaiKhoan = (Label)this.Master.FindControl("lbTaiKhoan");
                lbTaiKhoan.Text = Session["Provider"].ToString();
                Label lbLogout = (Label)this.Master.FindControl("lbLogout");
                lbLogout.Text = "<li><img src=\"../skin/frontend/default/inspire-blue/images/citydivider.jpg\"/></li>" +
                    "<li class=\"first\"><a href=\"index.aspx?logout=true\">Thoát</a></li>";
                Label lbDangKy = (Label)this.Master.FindControl("lbDangKy");
                lbDangKy.Text = "";
            }   
        }

        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            int idProduct = int.Parse(Request.QueryString["idProduct"].ToString());
            Response.Redirect("MuaHang.aspx?idProduct=" + idProduct.ToString());
        }
    }
}
